package chapter07

import scala.collection.mutable

object Test07_MutableSet {
  def main(args: Array[String]): Unit = {
    //1创建set
    val set1 = mutable.Set(13, 23, 53, 12, 13, 23, 78)
    println(set1)
    println("=============================================")
    //2.添加元素
    val set2 = set1 + 11
    println(set1)
    println(set2)
    set1 += 11
    println(set1)
    println("=============================================")
    val bool = set1.add(10)
    println(set1)
    println(bool)
    println("=============================================")
    val bool2 = set1.add(10)
    println(set1)
    println(bool2)
    println("=============================================")
    //3.删除元素
    val bool3 = set1.remove(10)
    println(set1)
    println(bool3)
    println("=============================================")
    //4.集合合并
    val set3 = set1 ++ set2
    println(set3)
    set1 ++= set3
    println(set1)
  }
}
